home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #6 / Amiga Plus CD - 2004 - No. 06.iso / AmigaPlus / Begleitmaterial / 50Tools / Grafik / PerfectPaint / rexx / bridge / Anim_Brush.rx next >
Text File  |  2002-12-11  |  7KB  |  380 lines

  1. /*
  2.     Arexx Text Script
  3.     V1.1
  4. */
  5.  
  6.     call addlib("rexxmathlib.library", 5, -30, 0)
  7.  
  8.     options results
  9.   parse ARG Port x y b
  10.     ADDRESS value Port
  11.  
  12.     pp_CountFrames
  13.     Total_Frame=result
  14.     Start_Frame=1
  15.     End_Frame=Total_Frame
  16.     if End_Frame<2 then do
  17.         pp_Warn 'Make*an*Anim*first.'
  18.         EXIT
  19.     end
  20.  
  21.     pp_GetDepth
  22.     Dp=result
  23.  
  24.     pp_GetWidthB
  25.     Bw=result
  26.  
  27.     pp_GetHeightB
  28.     Bh=result
  29.  
  30.     if Bw=0|Bh=0 then DO
  31.         pp_Warn 'Take*a*Brush*first.'
  32.         EXIT        
  33.     END
  34.  
  35.     Start_Shearx=0
  36.     Start_Sheary=0
  37.     Start_rotx=0
  38.     Start_roty=0
  39.     Start_rotz=0
  40.     Start_size=100
  41.     Start_Opacity=100
  42.  
  43.     End_Shearx=0
  44.     End_Sheary=0
  45.     End_rotx=0
  46.     End_roty=0
  47.     End_rotz=0
  48.     End_size=100
  49.     End_Opacity=100
  50.  
  51.     R=-1
  52.  
  53.     ADDRESS value Port
  54.  
  55.     Path=0;Type=0
  56.  
  57. DO UNTIL R>-1
  58.  
  59.     D.2='*Frame*(*#'||Start_Frame||'->#'||End_Frame||'*)*'
  60.  
  61.     D.3='*Shear*X*(*'||Start_Shearx||'*->*'||End_Shearx||'*)*'
  62.     D.4='*Shear*Y*(*'||Start_Sheary||'*->*'||End_sheary||'*)*'
  63.     D.5='*Rot*X*(*'||Start_rotx||'*->*'||End_rotx||'*)*'
  64.     D.6='*Rot*Y*(*'||Start_roty||'*->*'||End_roty||'*)*'
  65.     D.7='*Rot*Z*(*'||Start_rotz||'*->*'||End_rotz||'*)*'
  66.  
  67.     D.8='*Size*%*(*'||Start_size||'*->*'||End_size||'*)*'
  68.     D.9='*Opacity*(*'||Start_Opacity||'*->*'||End_Opacity||'*)*'
  69.  
  70.     pp_DialogInit 250 270 "*MOVE*" 10
  71.     pp_Cycle 0 70 5 100 16 "Path" 1 "None|Left|Right|Up|Down" Path
  72.     pp_Cycle 1 70 25 100 16 "Type" 1 "In|Out" Type
  73.         j=55
  74.         DO i=2 to 9
  75.             pp_Button i 20 j 200 16 D.i
  76.             j=j+20
  77.             if i=2 then DO;j=j+10;END
  78.             if i=7 then DO;j=j+10;END
  79.         END
  80.     pp_Dialog
  81.     R=result
  82.  
  83.     pp_GetDialog 0
  84.     Path=result
  85.  
  86.     pp_GetDialog 1
  87.     Type=result
  88.  
  89.     if R=-9 then DO
  90.         pp_DialogInit 150 80 "*OPACITY*" 2
  91.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Opacity
  92.             pp_Integer 1 60 25 50 16 "End" 1 End_Opacity
  93.         pp_Dialog
  94.         rc=result
  95.         IF rc=1 then DO
  96.             pp_GetDialog 0
  97.             Start_Opacity=result
  98.             pp_GetDialog 1
  99.             End_Opacity=result        
  100.         END            
  101.     END
  102.  
  103.     if R=-8 then DO
  104.         pp_DialogInit 150 80 "*SIZE*%*" 2
  105.             pp_Integer 0 60 5 50 16 "Start" 1 Start_size
  106.             pp_Integer 1 60 25 50 16 "End" 1 End_size
  107.         pp_Dialog
  108.         rc=result
  109.         IF rc=1 then DO
  110.             pp_GetDialog 0
  111.             Start_size=result
  112.             pp_GetDialog 1
  113.             End_size=result    
  114.         END            
  115.     END
  116.  
  117.     if R=-5 then DO
  118.         pp_DialogInit 150 80 "*ROT*X*" 2
  119.             pp_Integer 0 60 5 50 16 "Start" 1 Start_rotx
  120.             pp_Integer 1 60 25 50 16 "End" 1 End_rotx
  121.         pp_Dialog
  122.         rc=result
  123.         IF rc=1 then DO
  124.             pp_GetDialog 0
  125.             Start_rotx=result
  126.             pp_GetDialog 1
  127.             End_rotx=result        
  128.         END            
  129.     END
  130.  
  131.     if R=-6 then DO
  132.         pp_DialogInit 150 80 "*ROT*Y*" 2
  133.             pp_Integer 0 60 5 50 16 "Start" 1 Start_roty
  134.             pp_Integer 1 60 25 50 16 "End" 1 End_roty
  135.         pp_Dialog
  136.         rc=result
  137.         IF rc=1 then DO
  138.             pp_GetDialog 0
  139.             Start_roty=result
  140.             pp_GetDialog 1
  141.             End_roty=result        
  142.         END            
  143.     END
  144.  
  145.     if R=-7 then DO
  146.         pp_DialogInit 150 80 "*ROT*Z*" 2
  147.             pp_Integer 0 60 5 50 16 "Start" 1 Start_rotz
  148.             pp_Integer 1 60 25 50 16 "End" 1 End_rotz
  149.         pp_Dialog
  150.         rc=result
  151.         IF rc=1 then DO
  152.             pp_GetDialog 0
  153.             Start_rotz=result
  154.             pp_GetDialog 1
  155.             End_rotz=result        
  156.         END            
  157.     END
  158.  
  159.  
  160.     if R=-2 then DO
  161.         pp_DialogInit 150 80 "*FRAME*" 2
  162.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Frame
  163.             pp_Integer 1 60 25 50 16 "End" 1 End_Frame
  164.         pp_Dialog
  165.         rc=result
  166.         IF rc=1 then DO
  167.             pp_GetDialog 0
  168.             Start_Frame=result
  169.  
  170.             pp_GetDialog 1
  171.             End_Frame=result
  172.  
  173.             IF End_Frame>Total_Frame THEN DO
  174.                 End_Frame=Total_Frame
  175.             END
  176.  
  177.             IF Start_Frame>End_Frame THEN DO
  178.                 Start_Frame=1
  179.             END
  180.  
  181.         END            
  182.     END
  183.  
  184.     if R=-3 then DO
  185.         pp_DialogInit 150 80 "*SHEAR*X*" 2
  186.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Shearx
  187.             pp_Integer 1 60 25 50 16 "End" 1 End_Shearx
  188.         pp_Dialog
  189.         rc=result
  190.         IF rc=1 then DO
  191.             pp_GetDialog 0
  192.             Start_Shearx=result
  193.             pp_GetDialog 1
  194.             End_Shearx=result        
  195.         END            
  196.     END
  197.  
  198.     if R=-4 then DO
  199.         pp_DialogInit 150 80 "*SHEAR*Y*" 2
  200.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Sheary
  201.             pp_Integer 1 60 25 50 16 "End" 1 End_Sheary
  202.         pp_Dialog
  203.         rc=result
  204.         IF rc=1 then DO
  205.             pp_GetDialog 0
  206.             Start_Sheary=result
  207.             pp_GetDialog 1
  208.             End_Sheary=result        
  209.         END            
  210.     END
  211.  
  212. END
  213.  
  214.     if R=0 then DO
  215.         EXIT
  216.     END
  217.  
  218.     pp_FixBrush    
  219.     
  220.     ADDRESS COMMAND
  221.  
  222.     file='t:pp_Bmove'
  223.  
  224.     IF EXISTS(file) THEN DO
  225.         'delete >nil: t:pp_Bmove'
  226.     END
  227.  
  228.     IF OPEN('c',file,'W') then DO
  229.  
  230.         CALL WRITELN('c',Start_rotx)
  231.         CALL WRITELN('c',End_rotx)
  232.  
  233.         CALL WRITELN('c',Start_roty)
  234.         CALL WRITELN('c',End_roty)
  235.  
  236.         CALL WRITELN('c',Start_rotz)
  237.         CALL WRITELN('c',End_rotz)
  238.  
  239.         CALL WRITELN('c',Start_Shearx)
  240.         CALL WRITELN('c',End_Shearx)
  241.  
  242.         CALL WRITELN('c',Start_Sheary)
  243.         CALL WRITELN('c',End_Sheary)
  244.  
  245.         CALL WRITELN('c',Start_Size)
  246.         CALL WRITELN('c',End_Size)
  247.  
  248.         CALL WRITELN('c',Start_Opacity)
  249.         CALL WRITELN('c',End_Opacity)
  250.  
  251.         CALL CLOSE('c')
  252.     END
  253.  
  254.     ADDRESS value Port
  255.  
  256.     pp_GetBrushMode
  257.     BMode=result
  258.  
  259.     pp_GetWidth
  260.     W=result
  261.  
  262.     pp_GetHeight
  263.     H=result
  264.  
  265.     HX=Bw/2
  266.     HY=Bh/2
  267.  
  268.     Start_X=x
  269.     End_X=x
  270.     Start_Y=y
  271.     End_Y=y
  272.  
  273.     IF Path=1 then DO
  274.         IF Type=0 then DO
  275.             Start_X=HX*-1
  276.         END
  277.         ELSE
  278.         DO
  279.             End_X=HX*-1
  280.         END
  281.     END
  282.  
  283.     IF Path=2 then DO
  284.         IF Type=0 then DO
  285.             Start_X=W+HX
  286.         END
  287.         ELSE
  288.         DO
  289.             End_X=W+HX
  290.         END
  291.     END
  292.  
  293.     IF Path=3 then DO
  294.         IF Type=0 then DO
  295.             Start_Y=HY*-1
  296.         END
  297.         ELSE
  298.         DO
  299.             End_Y=HY*-1
  300.         END
  301.     END
  302.  
  303.     IF Path=4 then DO
  304.         IF Type=0 then DO
  305.             Start_Y=H+HY
  306.         END
  307.         ELSE
  308.         DO
  309.             End_Y=H+HY
  310.         END
  311.     END
  312.  
  313.     step=(End_Frame-Start_Frame)
  314.  
  315.     Step_rotx=(End_rotx-Start_rotx)/Step
  316.     Step_roty=(End_roty-Start_roty)/Step
  317.     Step_rotz=(End_rotz-Start_rotz)/Step
  318.     Step_Size=(End_Size-Start_Size)/Step
  319.     Step_Shearx=(End_Shearx-Start_Shearx)/Step
  320.     Step_Sheary=(End_Sheary-Start_Sheary)/Step
  321.     Step_Opacity=(End_Opacity-Start_Opacity)/Step
  322.  
  323.     Step_X=(End_X-Start_X)/Step
  324.     Step_Y=(End_Y-Start_Y)/Step
  325.     
  326.  
  327.     pp_Progresstext 'Move*Brush'
  328.     DO i=Start_Frame to End_Frame
  329.         pp_Progress (i-Start_Frame) (End_Frame-Start_Frame+1)
  330.         pp_GotoFrame i
  331.  
  332.         rotx=trunc(Start_rotx+Step_rotx*(i-Start_Frame)+0.5,0)
  333.         roty=trunc(Start_roty+Step_roty*(i-Start_Frame)+0.5,0)
  334.         rotz=trunc(Start_rotz+Step_rotz*(i-Start_Frame)+0.5,0)
  335.         Shearx=trunc(Start_Shearx+Step_Shearx*(i-Start_Frame)+0.5,0)
  336.         Sheary=trunc(Start_Sheary+Step_Sheary*(i-Start_Frame)+0.5,0)
  337.         Size=trunc(Start_Size+Step_Size*(i-Start_Frame)+0.5,0)
  338.         Opacity=trunc(Start_Opacity+Step_Opacity*(i-Start_Frame)+0.5,0)
  339.         X=trunc(Start_X+Step_X*(i-Start_Frame)+0.5,0)
  340.         Y=trunc(Start_Y+Step_Y*(i-Start_Frame)+0.5,0)
  341.         
  342.         pp_BrushOpacity Opacity
  343.  
  344.         Erxy=0
  345.         IF rotx=90|rotx=-90|rotx=270|rotx=-270|rotx=450|rotx=-450 then DO
  346.             Erxy=1
  347.         END
  348.         IF roty=90|roty=-90|roty=270|roty=-270|roty=450|roty=-450 then DO
  349.             Erxy=1
  350.         END
  351.  
  352.         IF Opacity>0 & Erxy=0 then DO    
  353.  
  354.             IF Size~=100 then DO
  355.                 SX=trunc((Bw*Size)/100+0.5,0)
  356.                 SY=trunc((Bh*Size)/100+0.5,0)
  357.                 pp_ScaleBrush SX SY
  358.             END
  359.  
  360.             IF rotx~=0|roty~=0|rotz~=0 then DO
  361.                 pp_BrushEffect 0 rotx roty rotz 2
  362.             END
  363.  
  364.             IF Shearx~=0 then DO
  365.                 pp_BrushEffect 1 Shearx 0 0 2
  366.             END
  367.  
  368.             IF Sheary~=0 then DO
  369.                 pp_BrushEffect 2 0 Sheary 0 2
  370.             END
  371.  
  372.             pp_Plot X Y
  373.         END
  374.         pp_RestoreBrush
  375.         pp_SetBrushMode BMode
  376.     END
  377.  
  378.     pp_GotoFrame Start_Frame
  379.     pp_Progressclr
  380.